package com.aliothservice.catfish.identity.data;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.data.annotation.Id;

public class EnterprisePending {
	
	@Id
	private String id;
	
	// links to User object
	private String phoneNumber;
	
	private String enterpriseName;
	private String province;
	private String city;
	private String district;
	private String address;
	private String contactName;
	private String contactPhoneNumber;
	
	// identities in GridFS
	private String licenseImageId;
	private String frontImageId;
	private String backImageId;
	private String recentPhotoId;
	
	private Date lastUpdateTime;
	
	private String status;
	
	private String descriptionOfReject;
	
	public Map<String, String> toMap() {
		Map<String, String> enterpriseMap = new HashMap<String, String>();
		enterpriseMap.put("id", this.getId());
		enterpriseMap.put("enterpriseName", getEnterpriseName());
		enterpriseMap.put("province", getProvince());
		enterpriseMap.put("city", getCity());
		enterpriseMap.put("district", getDistrict());
		enterpriseMap.put("address", getAddress());
		enterpriseMap.put("contactName", getContactName());
		enterpriseMap.put("contactPhoneNumber", getContactPhoneNumber());
		enterpriseMap.put("licenseImageId", getLicenseImageId());
		enterpriseMap.put("frontImageId", getFrontImageId());
		enterpriseMap.put("backImageId", getBackImageId());
		enterpriseMap.put("recentPhotoId", getRecentPhotoId());
		DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
		enterpriseMap.put("lastUpdateTime", formatter.format(this.getLastUpdateTime()));
		enterpriseMap.put("status", getStatus());
		if (null != getDescriptionOfReject()) {
			enterpriseMap.put("descriptionOfReject", getDescriptionOfReject());
		}
		
		return enterpriseMap;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEnterpriseName() {
		return enterpriseName;
	}

	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public Date getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(Date lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getLicenseImageId() {
		return licenseImageId;
	}

	public void setLicenseImageId(String licenseImageId) {
		this.licenseImageId = licenseImageId;
	}
	
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public String getContactPhoneNumber() {
		return contactPhoneNumber;
	}

	public void setContactPhoneNumber(String contactPhoneNumber) {
		this.contactPhoneNumber = contactPhoneNumber;
	}

	public String getDescriptionOfReject() {
		return descriptionOfReject;
	}

	public void setDescriptionOfReject(String descriptionOfReject) {
		this.descriptionOfReject = descriptionOfReject;
	}

	public String getFrontImageId() {
		return frontImageId;
	}

	public void setFrontImageId(String frontImageId) {
		this.frontImageId = frontImageId;
	}

	public String getBackImageId() {
		return backImageId;
	}

	public void setBackImageId(String backImageId) {
		this.backImageId = backImageId;
	}

	public String getRecentPhotoId() {
		return recentPhotoId;
	}

	public void setRecentPhotoId(String recentPhotoId) {
		this.recentPhotoId = recentPhotoId;
	}

	public static final String STATUS_UPSERTED = "upserted";
	public static final String STATUS_READY_FOR_REVIEW = "ready_for_review";
	public static final String STATUS_ACCEPTED = "accepted";
	public static final String STATUS_REJECTED = "rejected";

}
